﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using msBsc.AppLogic.DataAlc;

namespace msBsc.WebUi
{
    public partial class wfChangePass : msBsc.Cls.BPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { 
                Response.Expires = 0;
                Response.CacheControl = "no-cache";
                this.SetContrlValue("txtUserNme", msBsc.SvRef.UserInfo.Operator);
            }
        }


        public override void InitialByParam()
        {
            if (GetParamHtValue("ACTION") == "btnSave")
            {
                if (this.GetParamHtValue("NEW_PASS") != this.GetParamHtValue("CONFIRM_PASS"))
                {
                    this.Alert("新密码和新密码确认不相等！请重新输入！");
                    return;
                } 
                bool blSuc = false;
                string strMsg = msBsc.SvRef.UserInfo.ChangePass(this.GetParamHtValue("OLD_PASS"), this.GetParamHtValue("NEW_PASS"), out blSuc);
                if (blSuc && strMsg == "OK")
                {
                    this.Alert("已成功修改密码！");
                    this.CloseW(false);
                }
                else
                {
                    this.Alert(strMsg);
                }
            }

            base.InitialByParam();
        }
    }
}